﻿using NUnit.Framework;

namespace SwissKnife.Tests
{
    [TestFixture]
    public class ConversionTests
    {
        [Test]
        public void BytesToMegabytes()
        {
            const long bytes = 1024L * 1024L;

            var resMb = RadaCode.SwissKnife.Conversion.ComputerMeasurements.ConvertBytesToMegabytes(bytes);

            Assert.AreEqual(1, resMb);
        }

        [Test]
        public void KylobytesToMegabytes()
        {
            const long kbytes = 1024L;

            var resMb = RadaCode.SwissKnife.Conversion.ComputerMeasurements.ConvertKilobytesToMegabytes(kbytes);

            Assert.AreEqual(1, resMb);
        }

        [Test]
        public void BackAndForth()
        {
            long mbCount = 400;

            var bytes = RadaCode.SwissKnife.Conversion.ComputerMeasurements.ConvertMegabytesToBytes(mbCount);

            var mbs = RadaCode.SwissKnife.Conversion.ComputerMeasurements.ConvertBytesToMegabytes((long)bytes);

            Assert.AreEqual(mbCount, mbs);
        }
    }
}
